package com.design.principle.dependencyInversion;

/**
 * @program: designPattern
 * @description:
 * @author: STU756
 * @create: 2021-01-18 23:53
 */
public class DITest {
    public static void main(String[] args) {
        //V1 静态方法
        //Tom tom = new Tom();
        //tom.studyJavaCourse();
        //tom.studyPythonCourse();

        //============V2=========
//        Tom tom = new Tom();
//        tom.study(new JavaCourse());
//        tom.study(new PythonCourse());


        //========V3============通过构造器传入
//        Tom tom = new Tom(new JavaCourse());
//        tom.study();
//        tom = new Tom(new PythonCourse());
//        tom.study();

        //========V4============通过set函数传入
        Tom tom = new Tom();
        tom.setICourse(new JavaCourse());
        tom.study();
    }
}
